package com.yang.service;

import com.yang.entity.Address;
import com.yang.dao.AddressDao;
import com.yang.util.RespEntity;

import java.util.*;

public class AddressService {
    private final AddressDao addressDao = new AddressDao();

  //根据用户id查询
    public RespEntity queryByUserId(int userId) {
        List<Address> addressList = addressDao.queryByUserId(userId);
        return new RespEntity(200,"userId查询",addressList);
    }
    //根据id删除
    public RespEntity deleteById(int id) {
        int sum = addressDao.deleteByUserId(id);
        return new RespEntity(200,"删除",sum);
    }
    //添加收货地址
    public RespEntity savaAddress(Address address) {
        int sum = addressDao.saveAddress(address);
        return new RespEntity(200,"添加",sum);
    }
}
